/*
 * FramePreguntaJuridico.java
 *
 * Created on 30 de mayo de 2009, 1:43
 */

package GUI;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import jess.*;
/**
 *
 * @author  David
 */
public class FramePreguntaJuridicoNO extends javax.swing.JFrame {

    private JFrame framePadre;
    private Rete engine;
    private Batch batch;
    /** Creates new form FramePreguntaJuridico */
    public FramePreguntaJuridicoNO(JFrame fr,Rete eng,Batch bat) {
        this.engine=eng;
        batch=bat;
        this.setVisible(true);
        this.framePadre=fr;
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jComboBox_Preguntas = new javax.swing.JComboBox();
        jButtonVolver = new javax.swing.JButton();
        jButtonAsesorar = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel1.setText("Asesoramiento Jurídico");

        jLabel2.setText("Pregunta:");

        jComboBox_Preguntas.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "A", "C" }));

        jButtonVolver.setText("Volver");
        jButtonVolver.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonVolverActionPerformed(evt);
            }
        });

        jButtonAsesorar.setText("Asesorar");
        jButtonAsesorar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAsesorarActionPerformed(evt);
            }
        });

        jLabel3.setText("¿Deseas Informacion para trabajar por tu cuenta Autonomo (A)");

        jLabel4.setText("o por cuenta ajena (C)?");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(28, 28, 28)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 344, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE)
                            .addComponent(jLabel4)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(77, 77, 77)
                        .addComponent(jButtonVolver)
                        .addGap(56, 56, 56)
                        .addComponent(jButtonAsesorar)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(148, Short.MAX_VALUE)
                .addComponent(jComboBox_Preguntas, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(181, 181, 181))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(90, Short.MAX_VALUE)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(134, 134, 134))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(32, 32, 32)
                .addComponent(jLabel1)
                .addGap(45, 45, 45)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jComboBox_Preguntas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(65, 65, 65)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButtonVolver)
                            .addComponent(jButtonAsesorar))))
                .addGap(49, 49, 49))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jButtonVolverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonVolverActionPerformed
this.setVisible(false);     
    this.framePadre.setVisible(true);
}//GEN-LAST:event_jButtonVolverActionPerformed

private void jButtonAsesorarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAsesorarActionPerformed

    int indice =jComboBox_Preguntas.getSelectedIndex();
    System.out.println(indice);
    switch ( indice ) {
      case 0:                
        this.setVisible(false);
        try {
            this.engine.assertString("(trabajar A)");
            JFrame fram = new FramePreguntaJuridicoNO_A(this,this.engine,batch);
        } catch (Exception ex) {
            Logger.getLogger(FramePreguntasTecnico.class.getName()).log(Level.SEVERE, null, ex);
        }
           break;
      case 1:
        this.setVisible(false);
        try {
            this.engine.assertString("(trabajar C)");
            JFrame fram = new FramePreguntaJuridicoNO_C(this,this.engine,batch);
        } catch (Exception ex) {
            Logger.getLogger(FramePreguntasTecnico.class.getName()).log(Level.SEVERE, null, ex);
        }
       
           break;
          
      default:
           System.out.println("error" );
           break;
      }
}//GEN-LAST:event_jButtonAsesorarActionPerformed

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonAsesorar;
    private javax.swing.JButton jButtonVolver;
    private javax.swing.JComboBox jComboBox_Preguntas;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    // End of variables declaration//GEN-END:variables

}
